<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>四层级联选择器演示 - Vue3 + TypeScript</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }

        .demo-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0;
        }

        .demo-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            text-align: center;
            padding: 32px 20px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        }

        .demo-header h1 {
            margin: 0 0 12px 0;
            font-size: 2.2rem;
            font-weight: 700;
        }

        .demo-header p {
            margin: 0;
            font-size: 1.1rem;
            opacity: 0.9;
        }

        .main-content {
            padding: 32px 20px;
        }

        .content-section {
            background: white;
            border-radius: 16px;
            padding: 32px;
            margin-bottom: 24px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
            border: 1px solid #e9ecef;
        }

        .section-title {
            margin: 0 0 24px 0;
            color: #2c3e50;
            font-size: 1.4rem;
            font-weight: 700;
            border-bottom: 2px solid #f1f3f5;
            padding-bottom: 12px;
        }

        .cascader-container {
            max-width: 600px;
            margin-bottom: 32px;
        }

        .cascader-label {
            display: block;
            margin-bottom: 12px;
            font-weight: 600;
            color: #374151;
            font-size: 1rem;
        }

        /* 级联选择器样式 */
        .cascader-select {
            position: relative;
            width: 100%;
        }
        
        .input-wrapper {
            position: relative;
            cursor: pointer;
        }
        
        .cascader-input {
            width: 100%;
            padding: 12px 40px 12px 16px;
            border: 2px solid #e9ecef;
            border-radius: 8px;
            background-color: #fff;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 14px;
            line-height: 1.5;
            box-sizing: border-box;
        }
        
        .cascader-input:hover {
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }
        
        .cascader-input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }
        
        .arrow-icon {
            position: absolute;
            right: 16px;
            top: 50%;
            transform: translateY(-50%);
            color: #adb5bd;
            font-size: 12px;
            transition: transform 0.3s ease;
            pointer-events: none;
        }
        
        .arrow-icon.arrow-up {
            transform: translateY(-50%) rotate(180deg);
        }
        
        .cascader-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            right: 0;
            background: white;
            border: 2px solid #e9ecef;
            border-radius: 12px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
            z-index: 2000;
            margin-top: 8px;
            max-height: 450px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        .cascader-content {
            flex: 1;
            overflow: hidden;
        }
        
        .cascader-header {
            display: flex;
            border-bottom: 2px solid #e9ecef;
            background: #fff;
        }
        
        .cascader-header-item {
            flex: 1;
            min-width: 100px;
            width: 100px;
            padding: 8px 12px;
            font-weight: 600;
            font-size: 13px;
            color: #667eea;
            text-align: left;
            border-right: 1px solid #dee2e6;
            background: #fff;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        }
        
        .cascader-header-item:last-child {
            border-right: none;
        }
        
        .cascader-panels {
            display: flex;
            max-height: 350px;
            overflow: auto;
        }
        
        .cascader-panel {
            flex: 1;
            min-width: 100px;
            width: 100px;
            border-right: 1px solid #e9ecef;
            background: #fff;
        }
        
        .cascader-panel:last-child {
            border-right: none;
        }
        
        .cascader-option {
            padding: 8px 12px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 13px;
            color: #495057;
            transition: all 0.2s ease;
            position: relative;
        }
        
        .cascader-option:hover {
            background-color: #f8f9fa;
            color: #667eea;
        }
        
        .cascader-option.is-active {
            color: #667eea;
            background-color: #e7f3ff;
            font-weight: 500;
        }
        
        .cascader-option.is-selected {
            color: #667eea;
            font-weight: 600;
        }
        
        .cascader-option.has-children {
            padding-right: 40px;
        }
        
        .option-label {
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .option-arrow {
            color: #adb5bd;
            font-size: 12px;
            margin-left: 8px;
            font-weight: bold;
        }
        
        .cascader-footer {
            border-top: 1px solid #e9ecef;
            padding: 16px 20px;
            display: flex;
            justify-content: flex-end;
            gap: 12px;
            background: #fff;
        }
        
        .btn {
            padding: 8px 20px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            border: 2px solid;
            transition: all 0.3s ease;
        }
        
        .btn-cancel {
            background: #fff;
            color: #6c757d;
            border-color: #dee2e6;
        }
        
        .btn-cancel:hover {
            color: #495057;
            border-color: #adb5bd;
            background-color: #f8f9fa;
        }
        
        .btn-confirm {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #fff;
            border-color: transparent;
        }
        
        .btn-confirm:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }
        
        .btn-confirm:disabled {
            background: #adb5bd;
            border-color: #adb5bd;
            cursor: not-allowed;
            transform: none;
        }

        /* 选中信息样式 */
        .selection-info {
            background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
            border-radius: 12px;
            padding: 24px;
            border: 1px solid #cbd5e1;
            margin-top: 24px;
        }

        .selection-info h3 {
            margin: 0 0 20px 0;
            color: #1e40af;
            font-size: 1.2rem;
            font-weight: 600;
        }

        .info-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }

        .info-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .info-item .label {
            min-width: 80px;
            font-weight: 600;
            color: #6c757d;
        }

        .info-item .value {
            color: #495057;
            flex: 1;
        }

        .info-item .value.highlight {
            background: #e7f3ff;
            color: #667eea;
            padding: 4px 8px;
            border-radius: 4px;
            font-weight: 600;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
        }

        /* 层级详情样式 */
        .level-details {
            padding-top: 20px;
            border-top: 1px solid #e2e8f0;
        }

        .level-details h4 {
            margin: 0 0 16px 0;
            color: #374151;
            font-size: 1.1rem;
        }

        .level-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .level-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 8px 12px;
            background: white;
            border-radius: 6px;
            border: 1px solid #e5e7eb;
            transition: all 0.2s ease;
        }

        .level-item.is-deepest {
            background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
            border-color: #f59e0b;
        }

        .level-number {
            background: #3b82f6;
            color: white;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 600;
            min-width: 28px;
            text-align: center;
        }

        .is-deepest .level-number {
            background: #f59e0b;
        }

        .level-name {
            font-weight: 600;
            color: #4b5563;
            min-width: 80px;
        }

        .level-value {
            color: #1f2937;
            font-weight: 500;
        }

        .level-code {
            background: #f3f4f6;
            color: #6b7280;
            padding: 2px 6px;
            border-radius: 3px;
            font-size: 0.85rem;
        }

        /* 表格样式 */
        .table-container {
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid #e5e7eb;
            margin-top: 24px;
        }

        .demo-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
        }

        .demo-table th {
            background: #f8fafc;
            padding: 16px 12px;
            text-align: left;
            font-weight: 600;
            color: #374151;
            border-bottom: 2px solid #e5e7eb;
        }

        .demo-table td {
            padding: 12px;
            border-bottom: 1px solid #f1f3f5;
        }

        .demo-table tr:hover {
            background-color: #f9fafb;
        }

        .path-cell {
            font-size: 0.9rem;
            color: #6b7280;
            max-width: 300px;
        }

        .status-badge {
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 500;
        }

        .status-active {
            background: #d1fae5;
            color: #065f46;
        }

        .status-pending {
            background: #fef3c7;
            color: #92400e;
        }

        .loading-cell, .empty-cell {
            text-align: center;
            color: #6c757d;
            font-style: italic;
            padding: 40px;
        }

        /* 过渡动画 */
        .fade-slide-enter-active,
        .fade-slide-leave-active {
            transition: all 0.3s ease;
        }

        .fade-slide-enter-from {
            opacity: 0;
            transform: translateY(-10px);
        }

        .fade-slide-leave-to {
            opacity: 0;
            transform: translateY(10px);
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .main-content {
                padding: 16px 10px;
            }
            
            .content-section {
                padding: 20px;
            }
            
            .demo-header h1 {
                font-size: 1.8rem;
            }
            
            .info-grid {
                grid-template-columns: 1fr;
            }
            
            .level-item {
                flex-direction: column;
                align-items: flex-start;
                gap: 6px;
            }
            
            .table-container {
                overflow-x: auto;
            }
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="demo-container">
            <!-- 应用头部 -->
            <header class="demo-header">
                <h1>🔗 四层级联选择器演示</h1>
                <p>Vue3 + TypeScript 支持四层深度的级联选择器完整实现</p>
            </header>

            <!-- 主内容区域 -->
            <div class="main-content">
                <!-- 级联选择器区域 -->
                <section class="content-section">
                    <h2 class="section-title">📋 四层级联选择器</h2>
                    
                    <div class="cascader-container">
                        <label class="cascader-label">选择组件分类（支持四层深度）:</label>
                        <cascader-select
                            :model-value="selectedValue"
                            :options="fourLevelOptions"
                            placeholder="请选择组件分类..."
                            :header-labels="headerLabels"
                            @update:model-value="updateSelectedValue"
                            @change="handleCascaderChange"
                        ></cascader-select>
                    </div>

                    <!-- 选中信息展示 -->
                    <transition name="fade-slide">
                        <div v-if="selectedValue.length > 0" class="selection-info">
                            <h3>🎯 当前选中信息</h3>
                            <div class="info-grid">
                                <div class="info-item">
                                    <span class="label">完整路径:</span>
                                    <span class="value">{{ selectedLabels.join(' → ') }}</span>
                                </div>
                                <div class="info-item">
                                    <span class="label">选择层级:</span>
                                    <span class="value">第 {{ selectedValue.length }} 层 / 共 4 层</span>
                                </div>
                                <div class="info-item">
                                    <span class="label">请求参数:</span>
                                    <span class="value highlight">{{ requestParam }}</span>
                                </div>
                                <div class="info-item">
                                    <span class="label">层级说明:</span>
                                    <span class="value">{{ getLevelDescription() }}</span>
                                </div>
                            </div>

                            <!-- 层级详情 -->
                            <div class="level-details">
                                <h4>📊 层级详情</h4>
                                <div class="level-list">
                                    <div 
                                        v-for="(value, index) in selectedValue" 
                                        :key="index"
                                        class="level-item"
                                        :class="{ 'is-deepest': index === selectedValue.length - 1 }"
                                    >
                                        <span class="level-number">L{{ index + 1 }}</span>
                                        <span class="level-name">{{ headerLabels[index] }}:</span>
                                        <span class="level-value">{{ selectedLabels[index] }}</span>
                                        <code class="level-code">({{ value }})</code>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </transition>
                </section>

                <!-- 模拟表格区域 -->
                <section class="content-section">
                    <h2 class="section-title">📊 数据表格 (基于最深层级筛选)</h2>
                    
                    <!-- 请求信息 -->
                    <div class="selection-info">
                        <h3>🔧 API 请求信息</h3>
                        <div class="info-grid">
                            <div class="info-item">
                                <span class="label">请求参数:</span>
                                <span class="value">{{ formatRequestParams() }}</span>
                            </div>
                            <div class="info-item">
                                <span class="label">筛选逻辑:</span>
                                <span class="value">使用最深层级的 name 值 ({{ requestParam || 'null' }})</span>
                            </div>
                        </div>
                    </div>

                    <!-- 表格内容 -->
                    <div class="table-container">
                        <table class="demo-table">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>名称</th>
                                    <th>分类</th>
                                    <th>层级路径</th>
                                    <th>状态</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-if="loading">
                                    <td colspan="5" class="loading-cell">🔄 数据加载中...</td>
                                </tr>
                                <tr v-else-if="!tableData.length">
                                    <td colspan="5" class="empty-cell">📭 请选择筛选条件以加载数据</td>
                                </tr>
                                <tr v-else v-for="item in tableData" :key="item.id">
                                    <td>{{ item.id }}</td>
                                    <td>{{ item.name }}</td>
                                    <td>{{ item.category }}</td>
                                    <td class="path-cell">{{ item.path }}</td>
                                    <td>
                                        <span :class="['status-badge', `status-${item.status}`]">
                                            {{ item.statusText }}
                                        </span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </section>
            </div>
        </div>
    </div>

    <script>
        const { createApp, ref, computed } = Vue

        // 级联选择器组件
        const CascaderSelect = {
            props: {
                options: {
                    type: Array,
                    required: true
                },
                modelValue: {
                    type: Array,
                    default: () => []
                },
                placeholder: {
                    type: String,
                    default: '请选择'
                },
                headerLabels: {
                    type: Array,
                    default: () => ['分类', '子分类', '组件', '详细', '子项']
                }
            },
            emits: ['update:modelValue', 'change'],
            setup(props, { emit }) {
                const showDropdown = ref(false)
                const tempSelectedPath = ref([...props.modelValue])
                
                const cascaderPanels = computed(() => {
                    const panels = [props.options]
                    
                    let currentOptions = props.options
                    for (let i = 0; i < tempSelectedPath.value.length; i++) {
                        const selectedValue = tempSelectedPath.value[i]
                        const selectedOption = currentOptions.find(option => option.name === selectedValue)
                        
                        if (selectedOption && selectedOption.children) {
                            panels.push(selectedOption.children)
                            currentOptions = selectedOption.children
                        } else {
                            break
                        }
                    }
                    
                    return panels
                })
                
                const displayValue = computed(() => {
                    if (!props.modelValue.length) return ''
                    
                    let currentOptions = props.options
                    let finalLabel = ''
                    
                    for (const value of props.modelValue) {
                        const option = currentOptions.find(opt => opt.name === value)
                        if (option) {
                            finalLabel = option.nameCn
                            currentOptions = option.children || []
                        }
                    }
                    
                    return finalLabel
                })
                
                const toggleDropdown = () => {
                    showDropdown.value = !showDropdown.value
                    if (showDropdown.value) {
                        tempSelectedPath.value = [...props.modelValue]
                    }
                }
                
                const isOptionActive = (option, level) => {
                    return tempSelectedPath.value[level] === option.name
                }
                
                const handleOptionClick = (option, level) => {
                    const newPath = tempSelectedPath.value.slice(0, level)
                    newPath.push(option.name)
                    tempSelectedPath.value = newPath
                }
                
                const handleConfirm = () => {
                    const selectedOptions = []
                    let currentOptions = props.options
                    
                    for (const value of tempSelectedPath.value) {
                        const option = currentOptions.find(opt => opt.name === value)
                        if (option) {
                            selectedOptions.push(option)
                            currentOptions = option.children || []
                        }
                    }
                    
                    emit('update:modelValue', [...tempSelectedPath.value])
                    emit('change', [...tempSelectedPath.value], selectedOptions)
                    
                    showDropdown.value = false
                }
                
                const handleCancel = () => {
                    tempSelectedPath.value = [...props.modelValue]
                    showDropdown.value = false
                }
                
                const getHeaderLabel = (level) => {
                    return props.headerLabels[level] || `级别 ${level + 1}`
                }
                
                return {
                    showDropdown,
                    tempSelectedPath,
                    cascaderPanels,
                    displayValue,
                    toggleDropdown,
                    isOptionActive,
                    handleOptionClick,
                    handleConfirm,
                    handleCancel,
                    getHeaderLabel
                }
            },
            template: `
                <div class="cascader-select">
                    <div class="input-wrapper" @click="toggleDropdown">
                        <input
                            :value="displayValue"
                            :placeholder="placeholder"
                            readonly
                            class="cascader-input"
                        />
                        <span 
                            class="arrow-icon"
                            :class="{ 'arrow-up': showDropdown }"
                        >
                            ▼
                        </span>
                    </div>

                    <div 
                        v-show="showDropdown" 
                        class="cascader-dropdown"
                    >
                        <div class="cascader-content">
                            <div class="cascader-header">
                                <div 
                                    v-for="(panel, level) in cascaderPanels"
                                    :key="'header-' + level"
                                    class="cascader-header-item"
                                >
                                    {{ getHeaderLabel(level) }}
                                </div>
                            </div>
                            <div class="cascader-panels">
                                <div
                                    v-for="(panel, level) in cascaderPanels"
                                    :key="level"
                                    class="cascader-panel"
                                >
                                    <div
                                        v-for="option in panel"
                                        :key="option.name"
                                        class="cascader-option"
                                        :class="{
                                            'is-active': isOptionActive(option, level),
                                            'has-children': option.children && option.children.length > 0
                                        }"
                                        @click="handleOptionClick(option, level)"
                                    >
                                        <span class="option-label">{{ option.nameCn }}</span>
                                        <span 
                                            v-if="option.children && option.children.length > 0"
                                            class="option-arrow"
                                        >
                                            ＞
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="cascader-footer">
                            <button 
                                class="btn btn-cancel"
                                @click="handleCancel"
                            >
                                取消
                            </button>
                            <button 
                                class="btn btn-confirm"
                                @click="handleConfirm"
                                :disabled="!tempSelectedPath.length"
                            >
                                确定
                            </button>
                        </div>
                    </div>
                </div>
            `
        }

        // 主应用
        createApp({
            components: {
                CascaderSelect
            },
            setup() {
                // 修正后的四层数据结构
                const fourLevelOptions = ref([
                    {
                        name: 'component',
                        nameCn: '组件',
                        nameEn: 'Component',
                        children: [
                            {
                                name: 'basic',
                                nameCn: '基础组件',
                                nameEn: 'Basic',
                                children: [
                                    { 
                                        name: 'button', 
                                        nameCn: '按钮', 
                                        nameEn: 'Button',
                                        children: [
                                            { name: 'button11', nameCn: '按钮11', nameEn: 'Button11' },
                                            { name: 'input11', nameCn: '输入框11', nameEn: 'Input11' }
                                        ] 
                                    },
                                    { 
                                        name: 'input', 
                                        nameCn: '输入框', 
                                        nameEn: 'Input',
                                        children: [
                                            { name: 'button12', nameCn: '按钮12', nameEn: 'Button12' },
                                            { name: 'input112', nameCn: '输入框12', nameEn: 'Input12' }
                                        ]
                                    }
                                ]
                            },
                            {
                                name: 'basic2',
                                nameCn: '基础组件2',
                                nameEn: 'Basic2',
                                children: [
                                    { 
                                        name: 'button2', 
                                        nameCn: '按钮2', 
                                        nameEn: 'Button2',
                                        children: [
                                            { name: 'button21', nameCn: '按钮21', nameEn: 'Button21' },
                                            { name: 'input22', nameCn: '输入框22', nameEn: 'Input22' }
                                        ] 
                                    },
                                    { 
                                        name: 'input2', 
                                        nameCn: '输入框2', 
                                        nameEn: 'Input2',
                                        children: [
                                            { name: 'button23', nameCn: '按钮23', nameEn: 'Button23' },
                                            { name: 'input24', nameCn: '输入框24', nameEn: 'Input24' }
                                        ]
                                    }
                                ]
                            },
                            {
                                name: 'basic3',
                                nameCn: '基础组件3',
                                nameEn: 'Basic3',
                                children: [
                                    { 
                                        name: 'button3', 
                                        nameCn: '按钮3', 
                                        nameEn: 'Button3',
                                        children: [
                                            { name: 'button31', nameCn: '按钮31', nameEn: 'Button31' },
                                            { name: 'input32', nameCn: '输入框32', nameEn: 'Input32' }
                                        ]
                                    },
                                    { 
                                        name: 'input3', 
                                        nameCn: '输入框3', 
                                        nameEn: 'Input3',
                                        children: [
                                            { name: 'button33', nameCn: '按钮33', nameEn: 'Button33' },
                                            { name: 'input34', nameCn: '输入框34', nameEn: 'Input34' }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ])

                // 四层级联选择器的头部标签
                const headerLabels = ['根分类', '子分类', '组件类型', '具体组件']

                // 响应式数据
                const selectedValue = ref([])
                const selectedLabels = ref([])
                const tableData = ref([])
                const loading = ref(false)

                // 计算属性
                const requestParam = computed(() => {
                    if (!selectedValue.value.length) return ''
                    return selectedValue.value[selectedValue.value.length - 1]
                })

                // 方法
                const updateSelectedValue = (value) => {
                    selectedValue.value = value
                }

                const handleCascaderChange = (value, selectedOptions) => {
                    selectedLabels.value = selectedOptions.map(opt => opt.nameCn)
                    
                    console.log(`级联选择器变更: ${selectedLabels.value.join(' → ')}`)
                    console.log(`选择层级: 第 ${value.length} 层，提取请求参数: ${requestParam.value}`)
                    
                    if (requestParam.value) {
                        loadTableData(requestParam.value)
                    } else {
                        tableData.value = []
                    }
                }

                const getLevelDescription = () => {
                    const level = selectedValue.value.length
                    const descriptions = {
                        1: '已选择根分类',
                        2: '已选择到子分类',
                        3: '已选择到组件类型',
                        4: '已选择到具体组件（最深层级）'
                    }
                    return descriptions[level] || '未知层级'
                }

                const formatRequestParams = () => {
                    return JSON.stringify({
                        category: requestParam.value || null,
                        level: selectedValue.value.length,
                        fullPath: selectedValue.value,
                        page: 1,
                        pageSize: 20
                    }, null, 2)
                }

                const loadTableData = async (category) => {
                    loading.value = true
                    console.log(`开始请求表格数据: category=${category}`)
                    
                    try {
                        // 模拟API请求延迟
                        await new Promise(resolve => setTimeout(resolve, 1000))
                        
                        // 生成模拟数据
                        const mockData = generateMockData(category)
                        tableData.value = mockData
                        
                        console.log(`请求成功，获取到 ${mockData.length} 条数据`)
                    } catch (error) {
                        console.log(`请求失败: ${error}`)
                    } finally {
                        loading.value = false
                    }
                }

                const generateMockData = (category) => {
                    const pathMap = {
                        'button11': '组件 → 基础组件 → 按钮 → 按钮11',
                        'input11': '组件 → 基础组件 → 按钮 → 输入框11',
                        'button12': '组件 → 基础组件 → 输入框 → 按钮12',
                        'input112': '组件 → 基础组件 → 输入框 → 输入框12',
                        'button21': '组件 → 基础组件2 → 按钮2 → 按钮21',
                        'input22': '组件 → 基础组件2 → 按钮2 → 输入框22',
                        'button23': '组件 → 基础组件2 → 输入框2 → 按钮23',
                        'input24': '组件 → 基础组件2 → 输入框2 → 输入框24',
                        'button31': '组件 → 基础组件3 → 按钮3 → 按钮31',
                        'input32': '组件 → 基础组件3 → 按钮3 → 输入框32',
                        'button33': '组件 → 基础组件3 → 输入框3 → 按钮33',
                        'input34': '组件 → 基础组件3 → 输入框3 → 输入框34'
                    }

                    const baseData = [
                        { id: 1, name: `${category} 组件实例`, category: category, status: 'active', statusText: '启用' },
                        { id: 2, name: `${category} 高级版本`, category: category, status: 'active', statusText: '启用' },
                        { id: 3, name: `${category} 测试版本`, category: category, status: 'pending', statusText: '开发中' }
                    ]

                    return baseData.map(item => ({
                        ...item,
                        path: pathMap[category] || '未知路径'
                    }))
                }

                return {
                    fourLevelOptions,
                    headerLabels,
                    selectedValue,
                    selectedLabels,
                    tableData,
                    loading,
                    requestParam,
                    updateSelectedValue,
                    handleCascaderChange,
                    getLevelDescription,
                    formatRequestParams
                }
            }
        }).mount('#app')
    </script>
</body>
</html>
